/* STANDARD LIBRARY */
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<math.h>

/* ADDITIONAL LIBRARY */
#include"constants.h" // constants
#include"supToGSL.h" // support to GSL library
#include"supToMain.h" // supprot to main program (additional functions)
#include"setOfFuns.h" // set of functions to solve using GSL
#include"colorText.h" // functions which change color of text (for fun)
using namespace std;

int main()
{
	// cleanScrean();
	textInverse("\n Powtorzenie wynikow JJ i JK dla metody GA \n");
	textInverse("  Dla n=0.97, t1=1, t2=0.25, Beta=500, U=8 \n");
	textInverse("    h zmieniane od 0 do 0.2, krok 0.01     \n\n");
	textUnderlined();
	printf("Wyniki:   |   status  | iter |     mu        |	  m         |    d         | \n");
	textDefault();

	const size_t n1 = 3; 
	MultirootSolverF S1(&jkGA, n1);
	double _par1[6] = {0.1, 0.97, 1., 0.25, 500, 8}; // h, n, t1, t2, beta, U
	Parameters Par1(6, _par1);
	double _x1[n1] = {-0.4, 0.05, 0.3}; // mu, m, d
	Parameters *X1 = new Parameters(n1, _x1);
	for(double h=0.; h<=0.201; h+=0.01)
	{
		Par1[0] = h;
		printf("h = %.3f ", h);
		S1.solveFor(&Par1, X1);
		X1 = S1.getResult();
		S1.printResult();
	}
	delete X1;

	textInverse("\n Powtorzenie wynikow JJ i JK dla metody SGA \n");
	textInverse("  Dla n=0.97, t1=1, t2=0.25, Beta=500, U=8  \n");
	textInverse("    h zmieniane od 0 do 0.2, krok 0.01      \n\n");
	textUnderlined();
	printf("Wyniki:   |   status  | iter |     mu        |	  m         |    d         |    l_n       |   l_m        |  \n");
	textDefault();

	const size_t n2 = 5; 
	MultirootSolverF S2(&jkSGA, n2);
	double _par2[6] = {0.1, 0.97, 1., 0.25, 500, 8}; // h, n, t1, t2, beta, U
	Parameters Par2(6, _par2);
	double _x2[n2] = {3.5, 0.2, 0.3, -3.6, 0.4}; // mu, m, d, l_n, l_m
	Parameters *X2 = new Parameters(n2, _x2);
	for(double h=0.; h<=0.201; h+=0.01)
	{
		Par2[0] = h;
		printf("h = %.3f ", h);
		S2.solveFor(&Par2, X2);
		X2 = S2.getResult();
		S2.printResult();
	}
	delete X2;

	return 0;
}
//:~ end of main
